package com.cs.study.homework.demo.test;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class Server {
    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket = new ServerSocket(1234);
        Socket socket = serverSocket.accept();
        //OutputStream out = socket.getOutputStream();
        InputStream in = socket.getInputStream();
        byte[] bytes = new byte[100];
        int readCount = in.read(bytes);
        String s = new String(bytes,0,readCount);
        System.out.println(s);
        socket.close();
        serverSocket.close();
    }
}
